home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-9.10-netbook-remix-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / lib-tk / FixTk.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-11-11  |  2KB  |  68 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import sys
  5. import os
  6.  
  7. try:
  8.     import ctypes
  9.     ctypes.windll.kernel32.GetFinalPathNameByHandleW
  10. except (ImportError, AttributeError):
  11.     
  12.     def convert_path(s):
  13.         return s
  14.  
  15.  
  16.  
  17. def convert_path(s):
  18.     if isinstance(s, str):
  19.         s = s.decode('mbcs')
  20.     
  21.     hdir = ctypes.windll.kernel32.CreateFileW(s, 128, 1, None, 3, 33554432, None)
  22.     if hdir == -1:
  23.         return s
  24.     buf = ctypes.create_unicode_buffer(u'', 32768)
  25.     res = ctypes.windll.kernel32.GetFinalPathNameByHandleW(hdir, buf, len(buf), 0)
  26.     ctypes.windll.kernel32.CloseHandle(hdir)
  27.     if res == 0:
  28.         return s
  29.     s = buf[:res]
  30.     return s
  31.  
  32. prefix = os.path.join(sys.prefix, 'tcl')
  33. if not os.path.exists(prefix):
  34.     prefix = os.path.join(sys.prefix, os.path.pardir, 'tcltk', 'lib')
  35.     prefix = os.path.abspath(prefix)
  36.  
  37. if os.path.exists(prefix):
  38.     prefix = convert_path(prefix)
  39.     if not os.environ.has_key('TCL_LIBRARY'):
  40.         for name in os.listdir(prefix):
  41.             if name.startswith('tcl'):
  42.                 tcldir = os.path.join(prefix, name)
  43.                 if os.path.isdir(tcldir):
  44.                     os.environ['TCL_LIBRARY'] = tcldir
  45.                 
  46.             os.path.isdir(tcldir)
  47.         
  48.     
  49.     import _tkinter
  50.     ver = str(_tkinter.TCL_VERSION)
  51.     if not os.environ.has_key('TK_LIBRARY'):
  52.         v = os.path.join(prefix, 'tk' + ver)
  53.         if os.path.exists(os.path.join(v, 'tclIndex')):
  54.             os.environ['TK_LIBRARY'] = v
  55.         
  56.     
  57.     if not os.environ.has_key('TIX_LIBRARY'):
  58.         for name in os.listdir(prefix):
  59.             if name.startswith('tix'):
  60.                 tixdir = os.path.join(prefix, name)
  61.                 if os.path.isdir(tixdir):
  62.                     os.environ['TIX_LIBRARY'] = tixdir
  63.                 
  64.             os.path.isdir(tixdir)
  65.         
  66.     
  67.  
  68.